package cn.csust.net2.manager.client.ux;

import com.extjs.gxt.ui.client.widget.grid.CellEditor;

/**
 * Grid的编辑器的类型
 * @author 韩忠金
 *
 */
public enum EditorType {
	BeanCombo,DateField,NumberField_Long,NumberField_Double,NumberField_Integer,TextField,SimpleBox;
	/**
	 * 根据类型返回字段对应的编辑器
	 * @param editor
	 * @return
	 */
	public static CellEditor getCellEditor(EditorType editor){
		CellEditor cellEditor = null;
		switch(editor){
		case BeanCombo:
			;
		case DateField:
			;
		case NumberField_Long:
			;
		case TextField:
			;
		case SimpleBox:
			;
		}
		return cellEditor;
		
	}
	public static EditorType getEditorType(String key){
		if(key.equals("B"))
			return EditorType.BeanCombo;
		else if(key.equals("D"))
			return EditorType.DateField;
		else if(key.equals("N_L"))
			return EditorType.NumberField_Long;
		else if(key.equals("N_D"))
			return EditorType.NumberField_Double;
		else if(key.equals("N_I")||key.equals("N"))
			return EditorType.NumberField_Integer;
		else if(key.equals("S"))
			return EditorType.SimpleBox;
		else if(key.equals("T"))
			return EditorType.TextField;
		else
			return EditorType.TextField;
		
	}
}
